﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using UmlControlLibrary;

namespace UmlControlLibrary
{
    /// <summary>
    /// Interaction logic for UmlEnumerationControl.xaml
    /// </summary>
    public partial class UmlEnumerationControl : UmlDesignerElement
    {
        public static void RegisterControl()
        {
            SpecificMenu menu = SpecificMenu.GetTypeMenu(typeof(UmlDiagramControl));
            menu.AddItem(new SpecificMenuItem("Add enumeration", "Add", AddEnumeration));
        }

        public UmlEnumerationControl()
            : base()
        {           
            InitializeComponent();

            //            SetGradientStart("#FFFCEBFF"); violet
            //            SetGradientEnd("#FFF3AFFF");
            //            SetGradientStart("#FFFFFCEB"); // jaune
            //            SetGradientEnd("#FFFFF3AF");

            //            SetGradientStart("#FFEBFFFC"); // bleu ciel
            //            SetGradientEnd("#FFAFFFF3");


//            SetGradientStart("#FFFFEBFC"); // rose
//            SetGradientEnd("#FFFFAFF3");
//            SetGradientStart("#FFEBFCFF"); // turquoise
//            SetGradientEnd("#FFAFF3FF");
            SetGradientStart("#FFFCFFEB"); // jaune-vert
            SetGradientEnd("#FFF3FFAF");
        }

        public override void AddSections()
        {
            base.AddSections();
            AddSection("Literals", "Literals", "LiteralListView", null);
        }

        public static void AddEnumeration(object sender, RoutedEventArgs e)
        {
            ContextMenuEventArgs args = ((sender as Control).Tag as UmlContextMenu).MenuEventArgs;
            UmlDiagramControl diagram = (sender as MenuItem).DataContext as UmlDiagramControl;
            UmlEnumeration _enumeration = new UmlEnumeration("New_Enumeration");
            diagram.InsertionPos = new Point(args.CursorLeft, args.CursorTop);
            UmlModel.CurrentDiagram.AddElement(_enumeration);
        
        }

    }
}
